Skip to content

feat(core): hide standalone webfetch when Code Mode is available - #63659

Open
rekram1-node wants to merge 2 commits into
devfrom
codemode-webfetch
Open

rekram1-node wants to merge 2 commits into
devfrom
codemode-webfetch

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Issue for this PR

Standalone feature-flag experiment.

Type of change

  • New feature

What does this PR do?

Local and dev builds hide the standalone webfetch tool when a request offers Code Mode. The model can fetch URLs inside execute. Core checks the final tool list after plugins have removed or renamed tools.

Request Local / dev default Release default
Code Mode available Fetch inside Code Mode Both tools available
Code Mode unavailable Direct webfetch if permitted Direct webfetch if permitted

Set experimental.codemode_hide_webfetch to false to keep both tools, or true to try the dev behavior in a release.

With the experiment enabled, scripts receive the HTTP response body directly. The standalone reader also converts HTML to Markdown, limits the response size, and retries a Cloudflare challenge. Set the flag to false to use those features.

How did you verify your code works?

474 tests passed across 12 files, including request shaping and fetch permissions. The request-hook suite also passed ten randomized runs. Repository lint and all 35 typecheck tasks passed.

Visual

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 72" width="240" height="72" fill="currentColor"><text x="8" y="24" font-family="monospace" font-size="12">execute → fetch(url)</text><text x="8" y="54" font-family="monospace" font-size="12" opacity=".25">webfetch<animate attributeName="opacity" values=".8;.25;.25;.8" dur="4s" repeatCount="indefinite"/></text></svg>

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Public API: adds the experimental.codemode_hide_webfetch config flag (backwards compatible; off by default in releases)

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as described. The new check runs on the final tool list after plugin hooks, so renamed or removed tools are handled. Checked with the new request-shaping test (6/6), the packages/core session tests (801 pass, 1 skip, 0 fail) and tsc -b for core (clean). Code Mode's fetch checks the same webfetch permission rules, so access control is unchanged.

Public API: adds the config key experimental.codemode_hide_webfetch (also in openapi.json and the generated client types). Backwards compatible: release builds behave the same unless someone opts in.

One concern, inline: the standalone tool does more than Code Mode's fetch (markdown conversion, image attachments, a Cloudflare retry, an output size cap), so with the flag on by default in local/dev builds, models get raw HTML and no images.

return t ? [[name, { ...t, description: d.description, inputSchema: d.input }] as const] : []
}),
)
// Hooks can remove or rename execute. Check the resolved tool behind each advertised name.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hiding webfetch loses more than a duplicate tool. The standalone tool converts HTML to markdown, attaches images so the model can see them, retries Cloudflare challenges and caps the output size. Code Mode's fetch returns the raw Response, so with this flag the model gets raw HTML (more tokens) and cannot look at fetched images. The flag is on by default in local/dev builds, so those users get this now. The Meta system prompt (plugin/system-prompt/meta.txt) also still tells the model to use webfetch. Could Code Mode offer the markdown conversion (for example tools.webfetch inside execute), or could this gap be accepted explicitly as part of the experiment?

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My earlier point is addressed. The stale webfetch redirect line is gone from the Meta prompt; webfetch follows redirects itself, so that line no longer applied. The description now states that, with the experiment on, scripts get the raw response body without the Markdown conversion, size cap or Cloudflare retry, and that the flag can turn this off. The request-hook suite still passes (6/6). Nothing new to raise.

Public API: unchanged since the last review. The change adds experimental.codemode_hide_webfetch (config, OpenAPI spec, generated client types) and is backwards compatible.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant